import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Scanner;

public class Homework {

    public static void main(String[] args) {
        int[] array={1,1,2,1,2,5,4,5};
        boolean flag=false;
        for (int i = 0; i < array.length-2; i++) {
            if(array[i]%2!=0){
                if(array[i+1]%2!=0){
                    if(array[i+2]%2!=0){
                        flag=true;
                        System.out.println(flag);
                    }else{
                        i+=1;
                    }
                }else{
                    i+=2;
                }
            }
        }
        if(flag!=true){
        System.out.println(flag);
        }
    }

    public static void main7(String[] args) {
        int[] array={1,2,1,1,2,2,2};
        for (int i = 0; i < array.length; i++) {
            int count=0;
            for (int j = i; j < array.length; j++) {
                if(array[i]==array[j]){
                    count++;
                }
            }
            if(count> array.length/2){
                System.out.println(array[i]);
            }
        }
    }

    public static void main6(String[] args) {
        int[] array={1,2,2,1,3};
        int flag=0;
        for (int i = 0; i < array.length-1; i++) {
            flag^=array[i];
        }
        System.out.println(flag);
    }

    public static void main5(String[] args) {
        int[] nums={1,2,3,4,5,6,7,8,9};
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入数字");
        int target= scanner.nextInt();
        for (int i = 0; i < nums.length-1; i++) {
            for (int j = i; j < nums.length-1; j++) {
                if(nums[i]+nums[j]==target) {
                    System.out.println("相加数在数组中的下标");
                    System.out.println(i+","+j);
                    System.out.println("相加数的数");
                    System.out.println(nums[i] + "," + nums[j]);
                }
            }
        }
    }

    public static void bubbling(int[] array){
        for (int i = 0; i < array.length-1; i++) {
            boolean flag=false;
            for (int j = 0; j < array.length-1-i; j++) {
                if(array[j]>array[j+1]){
                    int tmp=array[j];
                    array[j]=array[j+1];
                    array[j+1]=tmp;
                    flag=true;
                }
                }
            if(flag==false){
                return;
            }
        }
    }

    public static void main4(String[] args) {
        int[] array={1,6,9,3,5,2,4};
        bubbling(array);
        for (int number:array
             ) {
            System.out.print(number+" ");
        }
    }

    public static int binary_search(int[] array,int key){
        int left=0;
        int right= array.length-1;
        while(left<=right){
            int tmp=(left+right)/2;
            if(array[tmp]<key){
                left=tmp+1;
            }else if(array[tmp]>key){
               right=tmp-1;
            }else{
                return tmp;
            }
        }
        return -1;
    }

    public static void main3(String[] args) {
        int[] array={1,2,3,4,5};
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入你要查找的数字");
        int key= scanner.nextInt();
        int ret=binary_search(array,key);
        System.out.println(ret);
    }

    public static void main2(String[] args) {
        int[] array = {1, 6, 3, 4, 5, 7};
        int[] array2 = new int[array.length];
        int left = 0;
        int right = array.length - 1;
            for (int i = 0; i < array.length; i++) {
                if (array[i] % 2 == 0) {
                    array2[right] = array[i];
                    right--;
                } else {
                    array2[left] = array[i];
                    left++;
                }
            }
            System.out.println(Arrays.toString(array2));
        }

    public static int[] transform(int[] array){
        int[] ret=new int[array.length];
        for (int i = 0; i < array.length; i++) {
            ret[i]=array[i]*2;
        }
        return ret;
    }
    public static void main1(String[] args) {
        int[] array={1,2,3};
        int[] flag= transform(array);
        System.out.println(Arrays.toString(array));
        System.out.println(Arrays.toString(flag));
    }
}
